#ifndef _RSCOMPRESS_H_H_
#define _RSCOMPRESS_H_H_

#include <windows.h>

#define RSCOMPRESS_OK 0

typedef int (*PCOM)(BYTE *dest,ULONG *destLen,const BYTE *source,ULONG sourceLen);
typedef int (*PUNCOM)(BYTE *dest,ULONG *destLen,const BYTE *source, ULONG sourceLen);
typedef UINT (*PCOMBOUND)(ULONG len);

class RSZLIB
{
private:
	PCOM pcom;
	PUNCOM puncom;
	PCOMBOUND pcombound;
	HINSTANCE hdll;
public:
	RSZLIB(void);
	~RSZLIB(void);
	int Compress(BYTE *dest,UINT *destLen,const BYTE *source,UINT sourceLen);
	int UnCompress(BYTE *dest,UINT *destLen,const BYTE *source,UINT sourceLen);
	UINT GetBound(UINT len);
};

#include "LzmaLib.h"

typedef int (__stdcall *PCOMLZMA)(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen,
  unsigned char *outProps, size_t *outPropsSize, /* *outPropsSize must be = 5 */
  int level,      /* 0 <= level <= 9, default = 5 */
  unsigned dictSize,  /* default = (1 << 24) */
  int lc,        /* 0 <= lc <= 8, default = 3  */
  int lp,        /* 0 <= lp <= 4, default = 0  */
  int pb,        /* 0 <= pb <= 4, default = 2  */
  int fb,        /* 5 <= fb <= 273, default = 32 */
  int numThreads /* 1 or 2, default = 2 */
  );

typedef int (__stdcall *PUNCOMLZMA)(unsigned char *dest, size_t *destLen, const unsigned char *src, SizeT *srcLen,
  const unsigned char *props, size_t propsSize);

class RSLZMA
{
private:
	PCOMLZMA pcom;
	PUNCOMLZMA puncom;
	HINSTANCE hdll;
	BYTE props[5];
	size_t propsize;

	//PCOMBOUND pcombound;
public:
	RSLZMA();
	~RSLZMA();
	int Compress(BYTE *dest,UINT *destLen,const BYTE *source,UINT sourceLen);
	int UnCompress(BYTE *dest,UINT *destLen,const BYTE *source,UINT sourceLen);
};

#endif
